package com.iwayin.core.common;

import java.util.Calendar;
import java.util.Date;

/**
 * @author LiuWenLong
 * @version 2011-9-26下午5:07:38
 */
public class HistoryInfoUtil {

	public static String getHistoryInfo(Date createTime) {
		if(createTime == null){
			return "";
		}
		String resultMessage = "";
		Calendar now = Calendar.getInstance();
		int mistiming = (int) ((now.getTimeInMillis() - createTime.getTime()) / 1000 / 60);
		if(mistiming <= 0){
			return "刚刚";
		}
		if(mistiming<60){
			resultMessage = mistiming + "分钟前";
		}else if(mistiming < 60*24){
			resultMessage = mistiming/60 + "小时前";
		}else{
			resultMessage = mistiming/60/24 + "天前";
		}
		return resultMessage;
	}
}
